package com.yanshibo.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yanshibo.bean.Dormitory;
import com.yanshibo.bean.Floor;
import com.yanshibo.bean.QueryVo;
import com.yanshibo.bean.User;
import com.yanshibo.dao.DormitoryDao;

@Service
@Transactional
public class DormitoryServiceImp implements DormitoryService {

	@Autowired
	private DormitoryDao dormitoryDao;
	
	public PageInfo<Dormitory> getDormitoryList(Integer pageNum, QueryVo vo) {
		// TODO Auto-generated method stub
		PageHelper.startPage(pageNum,3);
		List<Dormitory> list = dormitoryDao.getDormitoryList(vo);
		return new PageInfo<Dormitory>(list);
	}

	 
	public List<Floor> getFool() {
		// TODO Auto-generated method stub
		return dormitoryDao.getFool();
	}

	 
	public List<User> getUserList() {
		// TODO Auto-generated method stub
		return dormitoryDao.getUserList();
	}

	 
	public List<Dormitory> getDormitory() {
		// TODO Auto-generated method stub
		return dormitoryDao.getDormitory();
	}

	 
	public List<Dormitory> erji(Integer fid) {
		// TODO Auto-generated method stub
		return dormitoryDao.erji(fid);
	}

	 
	public Dormitory sanji(Integer did) {
		// TODO Auto-generated method stub
		return dormitoryDao.sanji(did);
	}


	public User login(User user) {
		// TODO Auto-generated method stub
		return dormitoryDao.login(user);
	}


	public PageInfo<User> selects() {
		// TODO Auto-generated method stub
		List<User> list = dormitoryDao.selects();
		
		PageInfo<User> info = new PageInfo<User>(list);
		
		return info;
	}


	public PageInfo<Dormitory> listDor() {
		// TODO Auto-generated method stub
		PageHelper.startPage(1, 3);
		
	  	List<Dormitory> list= dormitoryDao.listDor();
		
	  	//
	  	PageInfo<Dormitory> info = new PageInfo<Dormitory>(list);
	  	
		return info;
	}

}
